﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BLL.depotmanager
{
    public class UserService
    {
        public bool UpdateUserExp(ps_users model, string num, string username)
        {
            bool result = false;
            if (model.Update())
            {
                //mym.AddAdminLog("增加消费次数", "增加消费次数" + num + "次，会员卡号:" + username); //记录日志
                result = true;
            }

            return result;
        }

        public bool UpdateUserPoint(int _id, string rlbzj, string num)
        {
            ps_users model = new ps_users();
            model.GetModel(_id);
            bool result = false;
            if (rlbzj == "1")
            {
                model.point = model.point + int.Parse(num);
            }
            else
            {
                model.point = model.point - int.Parse(num);
            }
            if (model.Update())
            {
                //mym.AddAdminLog("增减积分", "增减积分" + txtnum.Text + "分，会员卡号:" + txtUserName.Text); //记录日志
                result = true;
            }

            return result;
        }

        public bool AddUser(ps_users model)
        {
            if (model.Add() > 0)
            {
                //mym.AddAdminLog("新增会员", "新增会员，会员卡号：" + model.title); //记录日志
                return true;
            }

            return false;
        }

        public bool UpdateUser(ref bool result, ps_users model)
        {
            if (model.Update())
            {
                //mym.AddAdminLog("修改会员", "修改会员，会员卡号：" + model.title); //记录日志
                result = true;
            }

            return result;
        }
    }
}
